package com.zcn.io.web.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zcn.io.common.entity.OrderMain;
import com.zcn.io.common.pojo.CommonResult;
import com.zcn.io.web.api.entity.KfPhone;
import com.zcn.io.web.api.query.OrderMainQuery;
import com.zcn.io.web.service.KfPhoneService;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @desc:
 * @author: 202438 邱建伟
 * @date: 2025/5/5 16:48
 * @Copyright (c) 2025, 江苏金恒信息科技股份有限公司
 */
@RestController
@AllArgsConstructor
@RequestMapping("/kfPhone")
public class kfPhoneController {

    private final KfPhoneService kfPhoneService;

    @GetMapping("/list")
    public CommonResult<Page<KfPhone>> list(Page<KfPhone> page, KfPhone kfPhone) {
        kfPhoneService.list(page, kfPhone);
        return CommonResult.success(page);
    }

    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody KfPhone kfPhone) {
        kfPhoneService.add(kfPhone);
        return CommonResult.success("新增成功");
    }

    @PostMapping("/update")
    public CommonResult<String> update(@RequestBody KfPhone kfPhone) {
        kfPhoneService.update(kfPhone);
        return CommonResult.success("修改成功");
    }

    @DeleteMapping("/delete")
    public CommonResult<String> delete(String id) {
        kfPhoneService.delete(id);
        return CommonResult.success("删除成功");
    }

    @GetMapping("/dict")
    public CommonResult<List<KfPhone>> dict(KfPhone kfPhone) {
        return CommonResult.success(kfPhoneService.dict(kfPhone));
    }
}
